﻿<AddDataFormTemplateSpec
	xmlns="bb_appfx_adddataformtemplate"
	xmlns:c="bb_appfx_commontypes"
	ID="5fa39eb7-3ffd-461f-8e2e-9cb9340932c7"
	Name="StewardshipPlanFromProspect Add Data Form"
	Description="Extends the 'Stewardship Plan From Prospect Add Form' with a Designation field for the TDSM datalist"
	Author="Blackbaud Professional Services"
	DataFormInstanceID="46c52c9d-9276-461c-83b1-560170d1615e"
	RecordType="Stewardship Plan"
	c:SecurityUIFolder="TDSM"
	>

    <SPDataForm>
        <SaveImplementation SPName="USR_USP_DATAFORMTEMPLATE_ADD_STEWARDSHIPPLAN_FROMPROSPECT_EXTENSION">
            <c:CreateProcedureSQL>
                <![CDATA[
create procedure dbo.USR_USP_DATAFORMTEMPLATE_ADD_STEWARDSHIPPLAN_FROMPROSPECT_EXTENSION
(
  @ID uniqueidentifier = null output
 ,@CONTEXTID uniqueidentifier
 ,@CHANGEAGENTID uniqueidentifier = null
 ,@DESIGNATIONID uniqueidentifier = null
)
as

set nocount on;

set @ID = isnull(@id,newid());

if @CHANGEAGENTID is null begin
  exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
end;

declare @CURRENTDATE datetime = getdate();

begin try
  insert into dbo.USR_STEWARDSHIPPLAN(ID,DESIGNATIONID,DATEADDED,ADDEDBYID,CHANGEDBYID)
  values(@CONTEXTID, @DESIGNATIONID,@CURRENTDATE,@CHANGEAGENTID,@CHANGEAGENTID);
end try
begin catch
  exec dbo.USP_RAISE_ERROR
  return 1
end catch

return 0;
]]>
            </c:CreateProcedureSQL>
        </SaveImplementation>
    </SPDataForm>

    <Context ContextRecordType="Stewardship Plan" RecordIDParameter="CONTEXTID"/>

    <c:FormMetaData FixedDialog="true">
        <c:FormFields>
            <c:FormField FieldID="DESIGNATIONID" DataType="Guid" Caption="Designation" CaptionResourceKey="$$designation">
                <c:SearchList SearchListID="3187706b-b1ee-410f-b599-27aee1b26237" EnableQuickFind="true" />
            </c:FormField>
        </c:FormFields>
    </c:FormMetaData>

    <c:DataFormExtension DataFormInstanceID="972d0d10-011c-4dad-82f7-8d2222ffd901" RenderStyle="AfterParent" TabCaption="Designation"/>

</AddDataFormTemplateSpec>